package com.tianhui.consignortwofei.mvp.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.tianhui.consignortwofei.R;
import com.tianhui.consignortwofei.mvp.model.enty.detailItem.DetailItemInfo;

import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
import org.yczbj.ycrefreshviewlib.holder.BaseViewHolder;

/**
 * @author fgs
 * @date 2020/8/26
 * @description
 **/
public class DetailItemAdapter extends RecyclerArrayAdapter<DetailItemInfo> {
    public DetailItemAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new DetailItemViewHolder(parent, R.layout.item_detail_item);
    }

    private class DetailItemViewHolder extends BaseViewHolder<DetailItemInfo> {

        private TextView titleTextView;
        private TextView contentTextView;

        public DetailItemViewHolder(ViewGroup parent, int res) {
            super(parent, res);
            titleTextView = getView(R.id.item_detail_item_titleTextView);
            contentTextView = getView(R.id.item_detail_item_contentTextView);

        }

        @Override
        public void setData(DetailItemInfo data) {
            super.setData(data);
            titleTextView.setText(data.title);
            contentTextView.setText(data.content);
        }
    }
}
